#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>

int main()
{
	int clnt_sock;
	struct sockaddr_in clnt_addr;
	
	// char message[30]={0};
	// memcpy(message,"this is client.",30);
	char *message="this is client.";
	int strLen=0;
	
	memset(&clnt_addr,0,sizeof(clnt_addr));
	
	clnt_sock=socket(AF_INET,SOCK_STREAM,0);
	assert(clnt_sock);
	
	clnt_addr.sin_family=AF_INET;
	clnt_addr.sin_addr.s_addr=inet_addr("127.0.0.1");
	clnt_addr.sin_port=htons(1024);
	
	int connectRe=connect(clnt_sock,
	(struct sockaddr*)&clnt_addr,
	sizeof(clnt_addr));
	if(connectRe!=0)
		perror("connect");

	int writeRe=write(clnt_sock,message,sizeof(message)+1);
	assert(writeRe>-1);

	close(clnt_sock);
	
	return 0;
}